
<!-- 正文开始 -->
<div class=" layui-form open-form">
  <div class="open-model">
    <div class="open-auto">

            <div class="layui-form lay-header" style="margin-top: 20px;height: 100px">
              <div class="toolbar">
                <div class="layui-form-item lay-query-content">
                  <div class="lay-query-box">
                    <div class="query-lt">
                      <div class="layui-inline">
                        <label class="layui-form-label w-auto">客户捆包号</label>
                        <div class="layui-input-inline mr0">
                          <input name="userBundleCode" class="layui-input" type="text"
                                 placeholder="请输入客户捆包号" autocomplete="off"/>
                        </div>
                      </div>
                      <div class="layui-inline">
                        <label class="layui-form-label w-auto">所属客户：</label>
                        <div class="layui-input-inline mr0">
                          <input name="customerName" class="layui-input" type="text"
                                 placeholder="请输入所属客户" autocomplete="off"/>
                        </div>
                      </div>
                      <div class="layui-inline">
                        <label class="layui-form-label w-auto">联系人：</label>
                        <div class="layui-input-inline mr0">
                          <input name="contactName" class="layui-input" type="text"
                                 placeholder="请输入联系人" autocomplete="off"/>
                        </div>
                      </div>
                      <div class="layui-inline">
                        <label class="layui-form-label w-auto">运单号：</label>
                        <div class="layui-input-inline mr0">
                          <input name="waybill" class="layui-input" type="text"
                                 placeholder="请输入运单号" autocomplete="off"/>
                        </div>
                      </div>
                      <div class="layui-inline">
                        <label class="layui-form-label w-auto">车牌号：</label>
                        <div class="layui-input-inline mr0">
                          <input name="plateNo" class="layui-input" type="text"
                                 placeholder="请输入车牌号" autocomplete="off"/>
                        </div>
                      </div>

                      <div class="layui-inline">
                        <label class="layui-form-label w-auto">开始时间：</label>
                        <div class="layui-input-inline mr0">
                          <input
                                  name="sTime"
                                  id="sTime"
                                  class="layui-input"
                                  type="text"
                                  placeholder="请选择开始时间"
                          />
                        </div>
                      </div>
                      <div class="layui-inline">
                        <label class="layui-form-label w-auto">结束时间：</label>
                        <div class="layui-input-inline mr0">
                          <input
                                  name="eTime"
                                  id="eTime"
                                  class="layui-input"
                                  type="text"
                                  placeholder="请选择结束时间"
                          />
                        </div>
                      </div>
                      <div class="layui-inline">
                        <button class="layui-btn icon-btn color-green" lay-filter="itemSubSearchTwo"
                                lay-submit layui-form-keyDownSearch="true">查询
                        </button>
                        <button class="layui-btn icon-btn color-white" lay-filter="itemResetsTwo"
                                lay-submit>重置
                        </button>
                      </div>
                    </div>
                    <div class="query-rt">

                    </div>
                  </div>
                </div>
              </div>
            </div>
      <div class="layui-form-item ">
        <button class="layui-btn" id="selectAll">确认选择</button>
      </div>
      <!-- 表格 -->
      <table class="layui-table" lay-filter="SelectTable" id="SelectTable"></table>

      <!--      <table class="layui-table" id="warehouseMaterialRequisitionRecordTable"-->
      <!--             lay-filter="warehouseMaterialRequisitionRecordTable"></table>-->
    </div>

  </div>
</div>

<script>
  layui.use(["layer", "form", "table", "admin", "laydate", "upload", "laytpl"], async function () {
    const table = layui.table;
    const config = layui.config;
    const laytpl = layui.laytpl;
    const form = layui.form;
    const admin = layui.admin;
    const layer = layui.layer;
    const upload = layui.upload;
    const laydate = layui.laydate;
    const $ = layui.jquery;
    const nowData = { ...parentData };
    console.log("nowData", nowData);
    // let url = 'warehouse/warehouse/productInventory/list'
    // if (nowData.productStatus){
    //   url = 'warehouse/warehouse/productInventory/list?productStatus=' + nowData.productStatus
    // }

    laydate.render({
      elem: '#sTime',
      format: 'yyyy-MM-dd',
    });

    laydate.render({
      elem: '#eTime',
      format: 'yyyy-MM-dd',
    });

    await admin.initDataSelectPro(
            "warehouse/warehouse/admin/productVariety/list",
            {
              limit: 99999,

            },
            "productVarietyId",
            "品种",
            (d) => {
              if (d.value) {
                productVarietyId = d.value;
              }
            },
            "varietyName"
    );

    await admin.initDataSelectPro(
            "warehouse/warehouse/admin/productMark/list",
            {
              limit: 99999,

            },
            "productMarkId",
            "牌号",
            (d) => {
              if (d.value) {
                productMarkId = d.value;
              }
            },
            "markName"
    );

    await admin.initDataSelectPro(
            "warehouse/warehouse/admin/productProducer/list",
            {
              limit: 99999,

            },
            "productProducerId",
            "生产商",
            (d) => {
              if (d.value) {
                processingType = d.value;
              }
            },
            "producerName"
    );


    var tableTwo = table.render({
      elem: "#SelectTable",
      url: config.base + 'warehouse/warehouse/shipmentOrderDetail/list?status=1',
      page: true,
      cols: [
        [
          { type: "radio" },
          {field: "shipment_order_code", title: "发货记录编号", align: "center"},
          {field: "user_bundle_code", title: "客户捆包号", align: "center"},
          {field: "sys_bundle_code", title: "内部捆包号", align: "center"},
          {field: "name", title: "联系人", align: "center"},
          {field: "CODE", title: "客户代码", align: "center"},
          {field: "waybill", title: "运单号", align: "center"},
          {field: "plate_no", title: "车牌号", align: "center"},
          {field: "shipment_order_status", title: "状态", align: "center",
            templet: function (d) {
              // 根据 status 的值返回对应的显示内容 0已撤销1.待受理2.已受理3.待发货4.已发货5.签收完成6.入库完成
              switch (d.shipment_order_status) {
                case '1':
                  return '<span>待签收</span>'; // 灰色
                case "2":
                  return '<span>已签收</span>'; // 灰色
                default:
                  return "未知状态";
              }
            },
          },
          {field: "create_time", title: "创建时间", align: "center"},
          {field: "creator_name", title: "创建人", align: "center"}
        ]
      ]
    });

    // 搜索
    form.on("submit(itemSubSearchTwo)", function (data) {
      tableTwo.reload({
        where: {
          ...data.field,
        },
        page: { curr: 1 }
      });
    });

    // 重置搜索
    form.on("submit(itemResetsTwo)", function (data) {
      tableTwo.reload({
        where: {
          ...admin.resetSearch(data.field),
        },
        page: { curr: 1 }
      });
    });

    form.render("select");


    $("#selectAll").click(function () {
      const checkStatus = table.checkStatus("SelectTable").data;
      console.log(checkStatus,"checkStatus")
      childData.SelectList = checkStatus;
      layer.close(nowData.zindex);
    });
  });
</script>

<style>
  .open-auto{
    position: relative;
    z-index: 10000;
    overflow: visible !important;
  }
  .layui-form-select dl{
    max-height:116.1px !important;
  }
</style>